package ucalgary.seng401.tss;

import java.util.Calendar;
import java.util.Date;

/**
 * SysClock class
 *
 */
public class SysClock {

	int t = 0; 					// 0 <= t <= 1,000,000 
	Date currentTime = null;	// 00:00:00 <= currentTime <= 23:59:59
	int mainClockPort = 241; 	// 0xF1
	int clockInterval = 1; 		// units of ms
	int interruptCounter = 0; 	// 0 <= InterruptCounter <= 999
	
	/**
	 * SysClock constructor
	 */
	public SysClock()
	{
		 currentTime = Calendar.getInstance().getTime();
	}

	/*
	//TODO FIX THIS
	public void setCurrentTime(Time currentTime) {
		this.currentTime = currentTime;
	}
	*/ 

	public int getMainClockPort() {
		return mainClockPort;
	}

	public void setMainClockPort(int mainClockPort) {
		this.mainClockPort = mainClockPort;
	}

	public int getClockInterval() {
		return clockInterval;
	}

	public void setClockInterval(int clockInterval) {
		this.clockInterval = clockInterval;
	}

	public int getT() {
		return t;
	}

	public void setT(int t) {
		this.t = t;
	}
	
	public void incrementT() { 
		this.t += 1; 
	}

	public Date getCurrentTime() {
		return currentTime;
	}
	
	public void setCurrentTime(int hours, int minutes, int seconds) { 
		currentTime.setHours(hours); 
		currentTime.setMinutes(minutes); 
		currentTime.setSeconds(seconds); 
	}
	
	public void updateCurrentTime() { 
		currentTime = Calendar.getInstance().getTime();
	}

	public int getInterruptCounter() {
		return interruptCounter;
	}

	public void setInterruptCounter(int interruptCounter) {
		this.interruptCounter = interruptCounter;
	}
	
	public void incrementInterruptCounter() { 
		this.interruptCounter += 1; 
	}
}
